package code.Frame.adminFrame;

import code.Frame.FrameManager;
import code.Main;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class mainFrame {
    public JPanel panel;
    private JButton personal;
    private JButton canteen;
    private JLabel title;
    private JButton back;

    public mainFrame() {
        personal.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                Main.frame.remove(Main.panel_now);
                Main.panel_now = FrameManager.admin_pinfo;
                FrameManager.piFrame.refresh_list();
                Main.frame.setContentPane(Main.panel_now);
                Main.panel_now.revalidate();
            }
        });
        back.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                Main.frame.remove(Main.panel_now);
                Main.panel_now = FrameManager.startPanel;
                Main.frame.setContentPane(Main.panel_now);
                Main.panel_now.revalidate();
            }
        });
        canteen.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e)
            {
                Main.frame.remove(Main.panel_now);
                Main.panel_now = FrameManager.admin_cinfo;
                FrameManager.ciFrame.refresh_table();
                Main.frame.setContentPane(Main.panel_now);
                Main.panel_now.revalidate();
            }
        });
    }
}
